package com.foundation.keyword;

import net.mindview.util.MapData;
import org.junit.Test;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @Description instanceof 关键字测试
 * @Author away
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2019/3/10
 */
public class Instanceof {


    @Test
    public void test() {
        Map father = new HashMap();
        Map sun = new LinkedHashMap();

        System.out.println("是否是当前类的实例 ："+(father instanceof HashMap));
        System.out.println("是否是当前类子类的实例 ："+(father instanceof LinkedHashMap));// false 说明父类不知道子类的信息
        System.out.println("是否是当前类父类的实例 ："+(father instanceof Map));
        System.out.println("是否是当前类爷爷类的实例 ："+(sun instanceof Map));



    }

}
